def decorator(fn):
    def inner(*args, **kwargs):
        print('前面添加功能')
        result = fn(*args, **kwargs)
        print('后面添加功能')
        return result
    return inner

# 装饰器
@decorator
def add1(num1, num2, num3):
    return num1 + num2 + num3
@decorator
def add2(num1, num2, num3, num4):
    return num1 + num2 + num3 + num4

if __name__ == '__main__':
    print(add1(1, 2, 2))
    print(add2(1, 2, 2, 4))